﻿Imports DAO
Imports DTO

Public Class SachBUS
    Public Shared Function ThemSach(ByVal s As SachDTO) As Boolean
        If SachDAO.SelectTLByName(s.TenSach) Is Nothing Then
            SachDAO.Insert(s)
            Return True
        Else
            Return False
        End If
    End Function

    Public Shared Function CapNhatSach(ByVal s As SachDTO) As Boolean
        If SachDAO.SelectSachTheoMa(s.MaSach) IsNot Nothing Then
            SachDAO.Insert(s)
            Return True
        Else
            Return False
        End If
    End Function

    Public Shared Function XoaSach(ByVal s As SachDTO) As Boolean
        If SachDAO.SelectSachTheoMa(s.MaSach) IsNot Nothing Then
            SachDAO.Delete(s)
            Return True
        Else
            Return False
        End If
    End Function
End Class
